(function($) {
	var DropObj = function(ele, options) {
		this.ele = ele;
		this.defaults = {
			width: "200px",
			top:this.ele.offset().top,
			left:this.ele.offset().left,
			height:this.ele.height(),
			data:{}
		}
		this.options = $.extend(this.defaults, options);

	}
	DropObj.prototype = {
		initDrop: function() {
			var args=this.defaults;
			var _This = this.ele;
			var outDiv = $("<div class='outDiv' style='display:none;background:#DDDDDD;position:absolute;'>");
			outDiv.css({
				top:args.top+args.height+5,
				left:args.left,
				width:args.width
			});
			$("body").append(outDiv);
			return (function() {
				_This.on("focus", function() {
                 
				});
				_This.on("keyup", args.data, function (e) {
				    e.stopImmediatePropagation();
					outDiv.html("")	
					if($(this).val()==""){
						outDiv.hide();
						return false;
					}
					outDiv.show();
					$.each(e.data, function(i,item) {
						outDiv.append("<div class='inneritem'>"+item+"</div>");
					});
				});
				outDiv.on("click", "div.inneritem", function (e) {
				    e.stopImmediatePropagation();
					_This.val($(this).html());
					outDiv.html("")	
					if(typeof(args.onSelect)=="function"){
						args.onSelect($(this).html());
					}					
				});
				$(window).on("click",function(){
					outDiv.html("").hide();
				});
			})();
		}
	};
	$.fn.DropList = function(options) {
		var newDrop = new DropObj($(this), options);
		return newDrop.initDrop();
	}
})(jQuery)